package org.bookshare.document.packager;

import java.io.File;
import java.io.IOException;

import org.apache.poi.hssf.record.formula.functions.T;
import org.bookshare.document.beans.DocumentSet;
import org.bookshare.document.beans.DocumentType;

/**
 * Package a set of documents.
 * @author Reuben Firmin
 * @param <T> the document type that the packager can handle
 */
public interface Packager<T extends DocumentType> {

    /**
     * Package a set of documents to a zip of the given name. The packaging may differ depending on the DocumentType
     * used in constructing this packager.
     * @param fileName The file name of the zip
     * @param documentSet The documents to package
     * @param outDir The directory to create the new package in
     * @return The file reference to the packaged documents
     * @throws IOException if file access fails
     */
    File packageDocuments(String fileName, DocumentSet<T> documentSet, File outDir)
    	throws IOException;

    /**
     * Package a set of documents to a zip of the given name. The packaging may differ depending on the DocumentType
     * used in constructing this packager.
     * @param fileName The file name of the zip
     * @param documentSet The documents to package
     * @param outDir The directory to create the new package in
     * @param topDir A new subdirectory within the outdir to wrap the package
     * @return The file reference to the packaged documents
     * @throws IOException if file access fails
     */
    File packageDocuments(String fileName, DocumentSet<T> documentSet, File outDir, String topDir)
    	throws IOException;
}
